package com.syedu.day10.example1;

/**
 * description：
 * @author Administrator
 * @date 2022/3/21 14:47
 */
public class SayHelloFactory {
    public static final int SAY_BY_ZH = 1;
    public static final int SAY_BY_EN = 2;
    public static final int SAY_BY_JP = 3;

    public static SayHello getInstance(int type) {
        SayHello sayHello = null;
        if (type == SAY_BY_ZH) {
            sayHello = new ZhSayHello();
        } else if (type == SAY_BY_EN) {
            sayHello = new EnSayHello();
        } else if (type == SAY_BY_JP) {
            sayHello = new JpSayHello();
        } else {
            System.out.println("参数不合法...");
        }
        return sayHello;
    }
}